﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Net;
using System.IO;
using System.Xml.Serialization;
using System.Xml;

namespace Adams.Web.Controllers
{
    public class EventsController : Controller
    {
        [AppendLayoutModel]
        public ActionResult Index()
        {
            var model = Logic.Events.Index.PageLoad();
            return View(MobileCheck.IsMobile() ? "Index.Mobile" : "Index", model);
        }

        public JsonResult GetEvents(DateTime start, DateTime end)
        {
            var model = Logic.Events.Index.GetEvents(start, end);
            return Json(model);
        }

        [AppendLayoutModel]
        public ActionResult Occurance(int id)
        {
            var model = Logic.Events.Occurance.PageLoad(id);
            if (model.Occurance == null)
            {
                return HttpNotFound();
            }
            else
            {
                return View(MobileCheck.IsMobile() ? "Occurance.Mobile" : "Occurance", model);
            }
        }
    }
}
